<?php
/**
 * Created by PhpStorm.
 * User: ybjaa
 * Date: 2017/7/19
 * Time: 10:07
 */

namespace App\Http\Controllers;


use App\Business\Article\CreateArticle;
use App\Business\Article\ArticlesList;
use App\Business\ReturnResult;

class ArticleController extends Controller
{


    /**
     * @return ReturnResult|string
     */
    public function CreateArticle()
    {

        $parameters=$this->getParameters();

        if(!$parameters) return ReturnResult::ParameterError()->ToJson();


        $business=new CreateArticle();
        $business->articleContent=$parameters->content;
        $business->articleTitle=$parameters->title;
        $business->type=$parameters->type;
        $business->articleWeight=$parameters->weight;
        return $business->Excute();
    }


    public function GetArticlesList()
    {
        $parameters=$this->getParameters();

        if(!$parameters) return ReturnResult::ParameterError()->ToJson();


        $business=new ArticlesList();
        $business->type=$parameters->type;
        $business->condition=$parameters->condition;
        return $business->Excute();
    }

}